package com.knowledge.plus.自定义注解.example2.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 实现spring类 WebMvcConfigurer，创建配置类把拦截器添加到拦截器链中
 *
 * @author PF.Tian
 * @since 2021/09/13
 */
@Configuration
public class InterceptorTrainConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new SourceAccessInterceptor()).addPathPatterns("/**");
    }

}
